FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["FaceService/FaceService.WebAPI/FaceService.WebAPI.csproj", "FaceService/FaceService.WebAPI/"]
RUN dotnet restore "FaceService/FaceService.WebAPI/FaceService.WebAPI.csproj"
COPY . .
WORKDIR "/src/FaceService/FaceService.WebAPI"
RUN dotnet publish "FaceService.WebAPI.csproj" -c Release -o /app/publish

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
RUN apt-get update && \
    apt-get install -y --no-install-recommends libgomp1 libfreetype6 libfontconfig1 && \
    rm -rf /var/lib/apt/lists/*
COPY --from=build /app/publish .
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["dotnet", "FaceService.WebAPI.dll"]